<%@page import="com.hotels.*"%>
<%@page import="java.util.List" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%

        int startID = 1;
        int endID = 10;
        if (request.getParameter("startid") != null) {
            startID = Integer.parseInt(request.getParameter("startid"));
        }
        if (request.getParameter("endid") != null) {
            endID = Integer.parseInt(request.getParameter("endid"));
        }

        HotelHelper helper = new HotelHelper();
        List hotels = helper.getHotels(startID, endID);
        int ccc = hotels.size();
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Hotels</h1>
        <form name="query" action="index.jsp">
            开始ID:<input type="text" name="startid" value=<%=startID%> />
            终止ID:<input type="text" name="endid" value=<%=endID%> />
            <input type="submit" value="刷新" name="sub" />
        </form>
        <%
            for(int i=0;i < ccc;i++){
                Hotel h = (Hotel)hotels.get(i);
                out.print(h.getHotelid() + ":" +  h.getHotelname() + "<br>");
            }
        %>
    </body>
</html>
